pp108 : Run-time Library for Hyperlink Composite Control

Run-time Library for Hyperlink Composite Control

This topic provides the run-time library that is used to create the Hyperlink composite control.


After you create the design-time library for the Hyperlink composite control, you need to associate run-time behavior to it. To do so, you need to first create a run-time type library for the control.

Use the following code to create the run-time library for theHyperlinkcomposite control.

<html><head> <script type="text/javascript"> setPublic(Hyperlink, "runtimeLibrary"); importType("cas.xforms.runtimelibrary.CompositeControl"); inherit(Hyperlink, CompositeControl); function Hyperlink() { } function Hyperlink.attachType( control ) { createHyperlink(control); } function Hyperlink.detachType( control ){} function createHyperlink(hyperlink) { // Get the Hyperlink text var labelText = hyperlink.getAttribute("textId"); // Create a Hyperlink element var linkElement = hyperlink.ownerDocument.createElement("a"); linkElement.innerText = (labelText) ? labelText : "Google search"; // set the Hyperlink url var url = hyperlink.getAttribute("linkId"); linkElement.setAttribute("href", (url)?url:"http://www.google.com"); // set the Hyperlink target to _blank. This ensures the link opens in a new window. linkElement.setAttribute("target", "_blank"); // append the Hyperlink element to the DIV. hyperlink.appendChild(linkElement); } </script> </head><body></body></htm


For details about creating a type library, see Migrating Libraries to Type Libraries.

Related reference

Design-time Library for Hyperlink Composite Control